// 引入自己配置的axios
import http from './axios'

// 获取菜单列表
export const getMenuListTreeApi = ()=> {
  // istree=1 加了这个就是树形结构
  return http("/menulist?istree=1")
}

// 删除菜单
export const delMenuApi = (id) => {
  return http.post('/menudelete', {id: id});
}

// 修改菜单
export const editMenuApi = (data) => {
  return http.post('/menuedit', data);
}

// 添加角色
export const addRoleApi = (data) => {
  return http.post('/roleadd', data);
}

// 编辑角色
export const editRoleApi = (data) => {
  return http.post('/roleedit', data);
}

// 获取角色列表
export const getRoleListApi = ()=> {
  return http("/rolelist")
}

// 删除角色
export const delRoleApi = (id) => {
  return http.post('/roledelete', {id: id});
}

// 添加管理员
export const addAdminApi = (data) => {
  return http.post('/useradd', data);
}

// 获取管理员总数
export const getUserNumApi = ()=> {
  return http("/usercount")
}

// 获取管理员列表
export const getUserListApi = (data)=> {
  return http("/userlist", {params: data})
}

// 获取分类列表
export const getCateListApi = ()=> {
  return http("/catelist?istree=1")
}

// 添加分类
export const addCateApi = (data) => {
  return http.post('/cateadd', data);
}

// 修改分类
export const editCateApi = (data) => {
  return http.post('/cateedit', data);
}

// 添加分类
export const addSpecsApi = (data) => {
  return http.post('/specsadd', data);
}

// 获取分类列表
export const getSpecsListApi = ()=> {
  return http("/specslist?page=1&size=99")
}

// 根据id获取分类列表
export const getListByIdApi = (id)=> {
  return http("/catelist", {params: {pid: id}})
}

// 根据id获取规格熟悉
export const getSpecsInfoByIdApi = (id)=> {
  return http("/specsinfo", {params: {id: id}})
}


// 获取商品列表
export const getGoodsListApi = ()=> {
  return http("/goodslist?page=1&size=99")
}

// PC端登录
export const userlogin = (data)=> {
  return http.post("/userlogin", data)
}

